
public class Test {
    public static void main(String[] args) throws Exception {
        catchException();
    }

    public static void catchException() throws Exception {
        try {
            throwSomeExeption();
        } catch (Exception e) {
            System.out.println(e.getMessage());
            throw new Exception("在catchException中重新抛出一个具体原因的异常");
        } finally {
            System.out.println("执行finally代码块");
        }
    }

    public static int throwSomeExeption() throws Exception {
        if (Math.random() > 0.5) {
            throw new Exception("throwSomeExeption出错了");
        } else {
            return 1;
        }
    }
}
